public class DuoTaiDemo10 {

    public static void main(String[] args) {
        test(new YZ());
    }

    public static void test(KuaiDi kuaiDi) {
        if(kuaiDi instanceof SF){
            ((SF) kuaiDi).a();
        }else if(kuaiDi instanceof  YZ){
            ((YZ) kuaiDi).b();
        }

    }
}


class KuaiDi {
    private String name;

    public KuaiDi() {
    }

    public KuaiDi(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void SongKuaiDi() {
        System.out.println("送快递");
    }
}

class SF extends KuaiDi {
    @Override
    public void SongKuaiDi() {
        System.out.println("用飞机送快递");
    }

    // 子类独特的行为
    public void a() {
        System.out.println("顺丰快");
    }
}

class YZ extends KuaiDi {
    @Override
    public void SongKuaiDi() {
        System.out.println("用火车送");
    }

    // 子类独特的行为
    public void b() {
        System.out.println("哪都通");
    }
}
